const {
    Keypair,
    Contract,
    SorobanRpc,
    TransactionBuilder,
    Networks,
    BASE_FEE,
    XdrLargeInt,
    scValToBigInt,
    scValToNative,xdr, ScInt, Xdr
} = require("@stellar/stellar-sdk");

let result_meta_xdr ="AAAAAwAAAAAAAAACAAAAAwABX6AAAAAAAAAAAPL2KG6fIUb12SQY4ih0h8+fRAj7mlzk0AyzlAZirFXtAAAAF0hO5T4AAFRoAAAABQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAERfAAAAABmblZTAAAAAAAAAAEAAV+gAAAAAAAAAADy9ihunyFG9dkkGOIodIfPn0QI+5pc5NAMs5QGYqxV7QAAABdITuU+AABUaAAAAAYAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAABX6AAAAAAZm/xLgAAAAAAAAABAAAAAgAAAAMAARF8AAAABgAAAAAAAAABY+1e+ig/uhvy7UL/Crzg+xAMbcXSYcUM/eBwTcGhc1sAAAAUAAAAAQAAABMAAAAAEh+9Tnjpg/mdrjew/FniwsWv5jPwB1YUOsenoVt7rI4AAAABAAAAAQAAAA8AAAAHQ09VTlRFUgAAAAADAAAAAgAAAAAAAAABAAFfoAAAAAYAAAAAAAAAAWPtXvooP7ob8u1C/wq84PsQDG3F0mHFDP3gcE3BoXNbAAAAFAAAAAEAAAATAAAAABIfvU546YP5na43sPxZ4sLFr+Yz8AdWFDrHp6Fbe6yOAAAAAQAAAAEAAAAPAAAAB0NPVU5URVIAAAAAAwAAAAMAAAAAAAAAAgAAAAMAAV+gAAAAAAAAAADy9ihunyFG9dkkGOIodIfPn0QI+5pc5NAMs5QGYqxV7QAAABdITuU+AABUaAAAAAYAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAABX6AAAAAAZm/xLgAAAAAAAAABAAFfoAAAAAAAAAAA8vYobp8hRvXZJBjiKHSHz59ECPuaXOTQDLOUBmKsVe0AAAAXSE+UIQAAVGgAAAAGAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAV+gAAAAAGZv8S4AAAAAAAAAAQAAAAAAAAABAAAAAAAAAAFj7V76KD+6G/LtQv8KvOD7EAxtxdJhxQz94HBNwaFzWwAAAAEAAAAAAAAAAgAAAA8AAAAHQ09VTlRFUgAAAAAPAAAACWluY3JlbWVudAAAAAAAAAMAAAADAAAAAwAAAAMAAAAA";


//console.log(JSON.stringify(xdr.TransactionMeta.fromXDR(result_meta_xdr,'base64')._value._attributes.sorobanMeta._attributes.events[0]._attributes.body));

let result_xdr = "AAAAAAAAmBEAAAAAAAAAAQAAAAAAAAAYAAAAAImvMYIBJfUttF03P/W0YVJHv26+Et0NTMH5qVS0McdBAAAAAA=="

//console.log(JSON.stringify(xdr.TransactionResult.fromXDR(result_xdr,'base64')));

let envelope_xdr= "AAAAAgAAAADy9ihunyFG9dkkGOIodIfPn0QI+5pc5NAMs5QGYqxV7QABRvQAAFRoAAAABgAAAAEAAAAAAAAAAAAAAABmb/FIAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABY+1e+ig/uhvy7UL/Crzg+xAMbcXSYcUM/eBwTcGhc1sAAAAJaW5jcmVtZW50AAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAHEh+9Tnjpg/mdrjew/FniwsWv5jPwB1YUOsenoVt7rI4AAAABAAAABgAAAAFj7V76KD+6G/LtQv8KvOD7EAxtxdJhxQz94HBNwaFzWwAAABQAAAABAAkZGAAAA9AAAACEAAAAAAABRpAAAAABYqxV7QAAAEBcaOgf7WI3J/wq3+Z69dh3+i75H2haYgijak9xGf1OKMQZxrjPls8idWB9AjPCvMTPWHoTLJty/uFZKpLj96AJ"
//console.log( JSON.stringify(xdr.TransactionEnvelope.fromXDR(envelope_xdr, 'base64')) );

let sbf = [67,79,85,78,84,69,82];

let buffer = Buffer.from(sbf);

console.log('buffer: ',buffer.toString() );

let t1 = [105,110,99,114,101,109,101,110,116];
let b1 = Buffer.from(t1);
console.log('b1: ', b1.toString());